package org.esprit.ocm.client.model.ec2.datasource;
//package org.esprit.ocm.client.model.datasource;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.esprit.ocm.client.model.VolumeRecord;
//import org.esprit.ocm.dto.impl.VolumeDescriptionDto;
//
//import com.smartgwt.client.data.DataSource;
//import com.smartgwt.client.data.fields.DataSourceTextField;
//import com.smartgwt.client.widgets.grid.ListGridRecord;
//
//public class VolumeLocalSD extends DataSource {
//
//	private static VolumeLocalSD	instance	= null;
//
//	public static VolumeLocalSD getInstance(List<VolumeDescriptionDto> volumes) {
//		if (instance == null) {
//			instance = new VolumeLocalSD("volumeLocalDS", volumes);
//		}
//		return instance;
//	}
//
//	public VolumeLocalSD(String id, List<VolumeDescriptionDto> volumes) {
//
//		setID(id);
//
//		DataSourceTextField idField = new DataSourceTextField("id", "id");
//		DataSourceTextField sizeField = new DataSourceTextField("size", "size");
//		DataSourceTextField statusField = new DataSourceTextField("status", "status");
//		DataSourceTextField dateField = new DataSourceTextField("date", "date");
//		DataSourceTextField instanceIdField = new DataSourceTextField("instanceId", "instanceId");
//
//		setFields(idField, sizeField, statusField, dateField, instanceIdField);
//
//		List<ListGridRecord> l = new ArrayList<ListGridRecord>();
//		for (VolumeDescriptionDto i : volumes) {
//			// ImageRecord to = new ImageRecord(i.getImageId(),
//			// i.getImageLocation(), i.getImageState(), i.getImageOwnerId(),
//			// String.valueOf(i
//			// .isPublic()), i.getArchitecture());
//
//			VolumeRecord to = new VolumeRecord();
//// TODO
////			to.setId(i.getImageId());
////			to.setManifest(i.getImageLocation());
////			to.setState(i.getImageState());
////			to.setOwner(i.getImageOwnerId());
////			to.setVisibility(String.valueOf(i.isPublic()));
////			to.setArchitecture(i.getArchitecture());
////
////			l.add(to);
//		}
//
//		// setTestData((DataClass[]) imageRecords.toArray());
//		setTestData(l.toArray(new VolumeRecord[0]));
//		setClientOnly(true);
//	}
//
//}
